package com.aizuda.oss.domain;

import com.aizuda.oss.strategy.impl.AliyunOssStrategy;
import lombok.Getter;

/**
 * <p>
 *
 * @author izyao
 * @since 2022/3/22
 */
@Getter
public enum OssEnum {

    ALIYUN("aliyun", AliyunOssStrategy.class);

    private final String key;

    private final Class ossStrategy;

    OssEnum(String key, Class ossStrategy) {
        this.key = key;
        this.ossStrategy = ossStrategy;
    }

    public static Class getStrategyClass(String key) {
        for (OssEnum ossEnum : values()) {
            if (ossEnum.getKey().equals(key)) {
                return ossEnum.getOssStrategy();
            }
        }
        return null;
    }
}
